﻿using BenCaoXuan.Infrastructure.Attr;
using BenCaoXuan.Infrastructure.Dto.PC;
using BenCaoXuan.Service.Interface.admin;
using BenCaoXuan.Service.Interface.PC;
using Microsoft.AspNetCore.Mvc;

namespace BenCaoXuan.Api.Admin.Controllers.pc
{
    [ApiGroup("PC(桌面端模块)")]
    public class SubscribeController : BaseController
    {
        private readonly I_Subscribe_Service _i_Subscribe_Service;

        public SubscribeController(I_Subscribe_Service i_Subscribe_Service,I_Login_Service login_Service) : base(login_Service)
        {
            _i_Subscribe_Service=i_Subscribe_Service;
        }



        /// <summary>
        /// 获取选中日期的所有预约数据
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="key"></param>
        /// <param name="date"></param>
        /// <returns></returns>

        [HttpGet]
        public async Task<IActionResult> Get_Time_Appointment(int? page = 1, int? limit = 5, string? key = "",string time="")
        {
            var result = await _i_Subscribe_Service.Get_Time_Appointment(time, new Sys_Dto
            {
                limit = limit ?? 5,
                page = page ?? 1,
                key = key ?? ""
            });

            return Ok(result);
        }

        /// <summary>
        /// 获取所有预约数据
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="key"></param>
        /// <returns></returns>

        [HttpGet]
        public async Task<IActionResult> Get_Appointment(int? page = 1, int? limit = 5, string? key = "")
        {
            var result = await _i_Subscribe_Service.Get_Appointment(new Sys_Dto
            {
                limit = limit ?? 10,
                page = page ?? 1,
                key = key ?? ""
            });

            return Ok(result);
        }
        /// <summary>
        /// 预约详情
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Appointment_Detail(string id)
        {
            var result = await _i_Subscribe_Service.Get_Appointment_Detail(id);

            return Ok(result);
        }

    }
}
